import pyautogui
from flask import Flask, jsonify, request
app = Flask(__name__)


@app.route('/data', methods=['GET'])
def get_data():
    region = pyautogui.locateCenterOnScreen('my_folder/qq1.png',grayscale=True)
    pyautogui.moveTo(region.x / 2, region.y/2, duration=0.25)
    pyautogui.leftClick(region.x / 2, region.y/2, duration=0.25)
    subject = "python邮件发送功能测试完成!!!!!"  # 项目标题
    # 这里只是示例，实际中你可能需要从数据库或其他数据源获取数据
    data = {'message': subject}
    return jsonify(data), 200


def doAuto():
    for i in range(10):
        print('Hello World!',0.2)

def main():
    ret = pyautogui.confirm(text='text', title='title')
    if ret != "OK":
        return
    doAuto()


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5090, debug=True)
